# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=libidl2
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.8.14
_pkgver=0.8
pkgrel=1
pkgdesc="A front-end for CORBA 2.2 IDL and Netscape's XPIDL (mingw-w64)"
arch=('any')
url="http://www.gnome.org"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-glib2")
makedepends=("${MINGW_PACKAGE_PREFIX}-pkg-config")
source=("${_realname}-${pkgver}.tar.bz2"::"https://download.gnome.org/sources/libIDL/${_pkgver}/libIDL-${pkgver}.tar.bz2"
        "0001-libidl2-0.8.14-remove-def-file.patch")
sha256sums=('c5d24d8c096546353fbc7cedf208392d5a02afe9d56ebcc1cccb258d7c4d2220'
            '50e712d744ee55b9401d8791372f9369eac4f65bc4f9e4c11b7ffbe3e75a5490')

prepare() {
  cd "${srcdir}"/libIDL-${pkgver}
  patch -ENp1 -i "${srcdir}/0001-libidl2-0.8.14-remove-def-file.patch"
  autoreconf -fiv
}

build() {
  cd "${srcdir}"/libIDL-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../libIDL-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make DESTDIR="${pkgdir}" install
}
